-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(core): Decrease number of Sentry stack frames for messages from captureConsoleIntegration
#18096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
captureConsoleIntegrationcaptureConsoleIntegration
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
chargome
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
JPeer264
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Change
This PR creates a synthetic exception already within the captureConsole handler, so that we minimize the number of Sentry stack frames in the stack trace. It also adjusts the
Client::captureMessagemethod to favor an already providedsyntheticExceptionover the one it would create.Context
If users set
attachStackTrace: truein their SDK config, our SDK will add stack frames from an internally created error ("synthetic exception") to events that don't have an original stack trace (e.g.captureMessagecalls orcaptureException('string error')). When usingcaptureConsoleIntegrationinstrumentation to automatically capture messages from console logs, the synthetic exception would be created so deeply in the call stack that the actualconsole.*call frame would no longer be in the stack trace due to Node limiting the number of frames to 10 by default.Users can increase the limit, for example by setting
Error.stackTraceLimit = N, but ideally they don't have to.Alternatives considered
We discussed setting
Error.stackTraceLimitto something like 50 (the max number of frames we parse) within the SDK but decided against it due to memory and payload concerns. We can revisit if stack frame limit problems get reported again.closes #18094